<!-- 通道收费报表 -->
<template>
  <div class="common-body-wrapper">
    <search-header single-width="130" :searchList="searchList" @changeHeight="toRetTable" @confirmSearch="toSearch" @handleChange="handleSearchChange"
    :isCheckbox="true" :isNeedTree="true" :paramName="paramName" @setSelectedNode="setSelectedNode"></search-header>

    <div class="common-table-tree-wrapper">
      <div class="common-table-wrapper">

        <multi-fun-table :sortColumn='notFormatColumn' :orderType='sortType' :fixed-cols="fixedCols" :is-reset-table="isResetTable" :theads-info="theadsInfo" :tbodys-info="tbodysInfo" @handleMultiCheck="handleMultiCheck" @handleSortColumn="handleSortColumn" @searchFn="getList" @getNextPage="getNextPage">
          <!--按钮-->
          <div class="operate-btn-group" slot="operateBtnGroup">
            <a class="ake_btn ake_btn_text" v-if="isPermmited('REPORT:CHANNEL_CHARGE:EXPORT')" @click.prevent="exportData()">导出</a>
            <a class="ake_btn ake_btn_text" v-if="isPermmited('REPORT:CHANNEL_CHARGE:REBUILD')" @click.prevent="reBuild()">重新生成</a>
          </div>

          <!--普通列-->
          <template slot="tdCell" slot-scope="props">

            <el-table-column v-if="props.isMultiHeader" :label="props.label" align="center">
              <template v-for="(item, index) in props.children">
                <el-table-column v-if="item.checked" :key="index" :label="item.text" min-width="30" :prop="item.prop" :sortable="item.sortable">
                </el-table-column>
              </template>
            </el-table-column>

            <el-table-column v-else :fixed="props.fixed" :label="props.label" :min-width="props.minWidth" :width="props.width" :prop="props.prop" :sortable="props.sortable">
              <template slot-scope="scope">
                <span v-if="'reno' == props.prop && scope.$index==0">合计</span>
                <span v-if="'reno' == props.prop && scope.$index!=0">{{ scope.$index }}</span>
                <span v-else>{{ scope.row[props.prop] }}</span>
              </template>
            </el-table-column>
          </template>

          <!--操作列内的按钮-->
          <!-- <template slot="operateCell" slot-scope="props">
                    <el-table-column :fixed="props.fixed" :label="props.label" min-width="130">
                        <template slot-scope="scope">
                            <el-button title="确认收款" size="small" type="primary" class="ake_btn ake_font_btn ake_btn_green" icon="circle-check" v-if="isPermmited('REPORT:PAY:CONFIRM_CHARGE') && scope.row.status=='FINISH_PAY'" @click="confirmOnlineReceipts(scope.row)"></el-button>
                        </template>
                    </el-table-column>
                </template> -->
        </multi-fun-table>

        <!---->
        <table-pagination :size="total" :cur-page="pageNumber" @backData="getPagination"></table-pagination>
      </div>
    </div>

    <ReBuildBtn ref="myReBuildBtn" :reqUrl="reqUrl" :timeDimensionList="timeDimensionList"></ReBuildBtn>
  </div>
</template>

<script>
import common from "@mixins/common.js";
import stardardList from "@mixins/tables/stardardList.js";

//modal
import invokeModal from "@mixins/modal/invokeModal.js";

// 引进vue的js
import channel_charge_report from "./js/channel_charge_report.js";
import ReBuildBtn from "@components/reBuildBtn/index.vue";

export default {
  name: 'reportChannelCharge',
  mixins: [common, stardardList, invokeModal, channel_charge_report],
  components: {
    ReBuildBtn: ReBuildBtn
  },
  data() {
    var today = [new Date(moment().subtract('days', 1).format("YYYY-MM-DD 00:00:00")), new Date(moment().subtract('days', 1).format("YYYY-MM-DD 23:59:59"))]; //昨天
    return {
      reqUrl: '/report/channel_charge/rebuild.do',
      timeDimensionList:[
        { name: "日报", value: "date" },
        { name: "月报", value: "month" },
      ],
      total: 0,
      fixedCols: 0,
      paramName: "parkIds",
      searchList: [
         {
          index: 0,
          isShow: true,
          type: "select",
          name: "reportDimension",
          text: "时间维度",
          value: "day",
          isHandleChange: true,
          options: [
            { name: "日报", value: "day" },
            { name: "月报", value: "month" },
            { name: "年报", value: "year" },
            { name: "自定义", value: "custom" }
          ]
        },
        {
          index: 1,
          format: "yyyy-MM-dd",
          isShow: true,
          type: "datePicker",
          pickerType: "daterange",
          name: "dateFromTo",
          propName: "reportDateFrom,reportDateTo",
          text: "日期",
          value: today,
          style: { width: "360px" }
        },
        {
          index: 2,
          isShow: true,
          type: "text",
          name: "query_channelName",
          propName: "query_channelName",
          text: "通道名称",
          value: ""
        }
      ],
      theadsInfo: [
        // { index: 0, isShow: false, prop: "reno", text: "序号", width: 68 },
        {
          index: 1,
          isShow: false,
          prop: "reportDateStr",
          text: "日期",
          minWidth: 90
        },
        {
          index: 2,
          isShow: false,
          prop: "parkName",
          text: "停车场",
          minWidth: 96
        },
        {
          index: 3,
          isShow: false,
          prop: "channelName",
          text: "通道名称",
          minWidth: 96
        },
        {
          index: 4,
          isShow: false,
          prop: "totalAmount",
          text: "实收总额",
          minWidth: 76
        },
        {
          index: 5,
          isShow: false,
          prop: "totalCount",
          text: "收款总次数",
        },
        {
          index: 6,
          isShow: false,
          prop: "normalAmount",
          text: "正常收款金额",
        },
        {
          index: 7,
          isShow: false,
          prop: "normalCount",
          text: "正常收款次数",
        },
        {
          index: 8,
          isShow: false,
          prop: "abnormalAmount",
          text: "异常收款金额",
        },
        {
          index: 9,
          isShow: false,
          prop: "abnormalCount",
          text: "异常收款次数",
        },
        {
          index: 10,
          isShow: false,
          prop: "arrearAmount",
          text: "补缴金额",
        },
        {
          index: 11,
          isShow: false,
          prop: "arrearCount",
          text: "补缴次数",
        },
        {
          index: 12,
          isShow: false,
          prop: "abOutUncollectedAmount",
          text: "异常放行未收金额",
          minWidth: 55
        },
        {
          index: 13,
          isShow: false,
          prop: "abOutUncollectedCount",
          text: "异常放行未收次数",
          minWidth: 55
        },
        {
          index: 14,
          isShow: false,
          prop: "gateOutUncollectedAmount",
          text: "非系统开闸未收金额",
          minWidth: 55,
          initHidden: true
        },
        {
          index: 15,
          isShow: false,
          prop: "gateOutUncollectedCount",
          text: "非系统开闸次数",
          minWidth: 55
        },
        {
          index: 16,
          isShow: false,
          prop: "discountAmount",
          text: "人工优惠金额",
        },
        {
          index: 17,
          isShow: false,
          prop: "discountCount",
          text: "人工优惠次数",
        }
      ],
      tbodysInfo: []
    };
  },
  filters: {
    formatBillStatus: function(billStatus) {
      return billStatus == 2 ? "已支付" : "未支付";
    }
  }
};
</script>

<style lang="less">
.user-row-modal {
  .modal-body {
    min-height: 400px;
  }
  .first-item {
    width: 240px;
  }
}

.role-select {
  width: 240px;
}

#parkNameListModal {
  min-height: 400px;
}
</style>